<!DOCTYPE html>  
<html>
<head>  
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<title>地图导航组件</title>  
<style type="text/css">  
html{height:100%}  
body{height:100%;margin:0px;padding:0px}  
#container{height:100%}  
</style>  
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=GnFyOpEtDipk8Ciljbehmihmg0gy8AuB">
//v2.0版本的引用方式：src="http://api.map.baidu.com/api?v=2.0&ak=您的密钥"
</script>
</head>  
 
<body>  
<div id="container"></div> 
<script type="text/javascript"> 
	// 百度地图API功能
	var map = new BMap.Map("container");
	var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});
	var top_left_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT});
	map.addControl(top_left_control);
	map.addControl(top_left_navigation);
	var point = new BMap.Point(116.331398,39.897445);
	map.centerAndZoom(point,12);
	var  pointB = new BMap.Point(120.4432278872,36.0678030873);
	var geolocation = new BMap.Geolocation();
	geolocation.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			var mk = new BMap.Marker(r.point);
			map.addOverlay(mk);
			map.panTo(r.point);
			var walking = new BMap.WalkingRoute(map, {renderOptions:{map: map, autoViewport: true}});
			
			walking.search(r.point,pointB);
			walking.getResults();
		}
		else {
			alert('failed'+this.getStatus());
		}        
	},{enableHighAccuracy: true})
	
</script>  
</body>  
</html>